import {mapMutations} from 'vuex';
import loginSuccess from './loginSuccess.js';
let mixin = {
	methods:{
		...mapMutations({
			login: 'user/login',
			logout: 'user/logout',
		}),
		loginSuccess(result){
			loginSuccess(result);
			if (result.type == "register") {
				result.userInfo._id = result.uid;
			}
			this.login(result.userInfo);
		},
		userLogout(){
			this.logout();
		}
	}
}
export default mixin